import request from '@/utils/request'
import qs from 'qs'

//获取表格数据
export function getTableList(pageNumber, pageSize, queryList) {
  return request({
    url: '/merchant/merchant/list',
    method: 'get',
    params: {
      pageNumber: pageNumber,
      pageSize: pageSize,
      name: queryList.name,
    }
  })
}

// 创建商户
export function addMerchant(form) {
  return request({
    url: '/merchant/merchant/save_merchant',
    method: 'post',
    data: qs.stringify({
      businessLicense: form.businessLicense,
      legalPerson: form.legalPerson,
      name: form.name,
      adminAccount: form.adminAccount,
      username: form.username,
    }, {indices: false})
  })
}

// 修改商户
export function editMerchant(form) {
  return request({
    url: '/merchant/merchant/update',
    method: 'post',
    data: qs.stringify({
      id: form.id,
      businessLicense: form.businessLicense,
      legalPerson: form.legalPerson,
      name: form.name,
    }, {indices: false})
  })
}

// 查看商户的门店
export function findStoreInfo(merchantId) {
  return request({
    url: '/merchant/merchant/find_store_info',
    method: 'get',
    params: {
      merchantId
    }
  })
}




